<!DOCTYPE html>
<html lang="en" id="iframe-addFolder">
<head>
    <meta charset="UTF-8">
    <title>修改昵称</title>
    <link href="/user/css/my.css" rel="stylesheet">
    <link href="/index/css/bootstrap.min.css" rel="stylesheet">
    <link href="/manager/css/layui.css" rel="stylesheet">
    <link href="/toastr/toastr.min.css" rel="stylesheet">
    <script src="/index/js/jquery-1.7.2.js"></script>
    <script src="/toastr/toastr.min.js"></script>
    <script src="/manager/js/my.js"></script>
    <style type="text/css">
        input{
            width: 320px;
            height: 40px;
        }
        button{
            width: 320px;
            height: 40px;
        }
    </style>
    <script type="text/javascript">
        $(function () {
            toastr.options = {
                'positionClass': 'toast-top-center',
                'timeOut': '4000',
            };
            $(".btn").click(function () {
               let name = $("#folderName").val();
               name = name.replace(/^\s\s*/, '').replace(/\s\s*$/, '');
               if(name.length < 1) $("#error").text("请输入收藏夹名");
               else{
                   $("#error").text("");
                   $.post("/safety/addFolder","folderName=" + name,function (response) {
                       if(response.rspCode == "100"){
                           $("#folderName").val("");
                           refreshFolders();
                           toastr.success("收藏夹创建成功！", "操作成功");
                       }
                       else if(response.rspCode == "101"){
                           toastr.error(response.rspMsg, "操作失败！");
                       }
                   },"json").error(function () {
                       window.location.top.reload();
                   });
               }
            });
        });
    </script>
</head>
<body style="background-color: ghostwhite">
    <div style="padding: 18px;background-color: white"><h3 style="color: #0b3275;">新建文件夹</h3></div><br>
    <div style="padding-left: 15px">
        <input id="folderName" type="text" placeholder="收藏夹名" style="padding-left: 15px"><br>
        <span style="color: red" id="error"></span>
        <br><br>
        <button class="button btn btn-success mt-lg" role="button">提交</button>
    </div>
</body>
</html>